package com.csii.activiti.server.core.service;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csii.activiti.server.core.entity.ActFlowPageData;
import com.csii.activiti.server.core.entity.db.ActCommonDataEntity;
import com.csii.activiti.server.core.query.QueryActCommonData;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;

import java.util.List;
import java.util.Map;

public interface FlowDataManagementService {

    /**
     * 发布数据处理
     * @return
     */
    void publishDataProcess(List<ActCommonDataEntity> originalCommonDataList, List<ActCommonDataEntity> currentCommonDataList, String flowKey,String flowName);


    /**
     * 数据查询
     * @return
     */
    Page<Map<String,Object>> queryData(QueryActCommonData queryActCommonData,Page page);

    /**
     * 查询页面数据
     * @return
     */
    ActFlowPageData queryPageData(String flowKey);
    /**
     * 数据更新
     * @return
     */
    void updateData(String flowKey, Map<String, Object> data,List<ActCommonDataEntity> commonDataList);


    /**
     * 添加数据
     * @return
     */
    default void addData(String flowKey, Map<String, Object> data,List<ActCommonDataEntity> commonDataList){
        batchAddData(flowKey, CollUtil.newArrayList(data),commonDataList);
    }

    /**
     * 批量添加数据
     * @return
     */
    void batchAddData(String flowKey, List<Map<String, Object>> dataList,List<ActCommonDataEntity> commonDataList);

    /**
     * 根据流程实例ID添加数据
     * @return
     */
    void addData(String processInstanceId);

    /**
     * 根据流程实例添加数据
     * @return
     */
    void addData(Map<String, Object> formData, ExecutionEntity processInstance,String status);

}
